﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using XiaoYuStock.Model.Request;
using XiaoYuStock.Model;
using XiaoYuStock.Model.Models;
using XiaoYuStockAnalysis.BusinessLogic.Business;
using XiaoYuStock.AppService;
using XiaoYuStock.Model.Entities;
namespace XiaoYuStock.WebApp.Controllers
{
    public class StatisticsController :  BaseController
    {

        public ActionResult Index()
        {

            LoadType(AnalysedType.SequenceIncrease);
            return View(new PagedList<AnalysisDataModel>(new List<AnalysisDataModel>(), 1, 20, 0));
        }
        private void LoadType(AnalysedType type)
        {

            var list = BaseEnum.GetEnumAttrList<AnalysedType>();

            ViewBag.AnalysedType = new SelectList(list, "Key", "Value.Cname", type);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public ActionResult Index(AnalysisRequest request)
        {
            var aType = AnalysedType.SequenceIncrease;
            if (request.AnalysedType.HasValue)
                aType = (AnalysedType)request.AnalysedType;
            LoadType(aType);
            AnalysisDataBusiness business = new AnalysisDataBusiness();
            return View(business.GetList(request));
        }
      

       
    }
}
